#include<iostream>
#include<string>
#include<vector>
int split(const std::string& str,const std::string &sep,std::vector<std::string>& result)
{
   size_t pos,idx=0;
   while(idx<str.size())
   {
     pos=str.find(sep,idx);
     if(pos==std::string::npos)
     {
        return result.size();
     }

      if(pos==idx)
      {
        idx=pos+sep.size();
        continue;
      }
     result.push_back(str.substr(idx,pos-idx));
     idx=pos+sep.size();

   } 
 return result.size();
}
int main()
{

  std::string str="...news...music.#.pop...";
  std::vector<std::string> arry;
  int n=split(str,".",arry);
  for(auto& s:arry)
  {
    std::cout<<s<<std::endl;
  }
  return 0;
}
